# Contributor: <xmingske@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_pkgname=chardet
pkgname=py3-$_pkgname
pkgver=3.0.4
pkgrel=4
pkgdesc="The Universal Character Encoding Detector"
url="https://github.com/chardet/chardet/"
arch="noarch"
license="LGPL-2.1-or-later"
depends="python3 py3-setuptools"
checkdepends="py3-pytest"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz
	440828f8faafdb58700c64a9ea8f6a30b154c08b.patch"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-chardet" # Backwards compatibility
provides="py-chardet=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	python3 setup.py build
}

check() {
	python3 -m pytest
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
}

sha512sums="61a03b23447a2bfe52ceed4dd1b9afdb5784da1933a623776883ee9f297e341f633e27f0ce0230bd5fdc5fdb5382105ab42736a74a417ddeb9f83af57455dba5  chardet-3.0.4.tar.gz
6b4f87cca02579e2499b590e3bc85ef5afc5ced7a94af65af9669ed06a493deb01dd9a211bbc01d75fef2e7cb7b4157d3480afb32b113a24dd21e88aed8638ad  440828f8faafdb58700c64a9ea8f6a30b154c08b.patch"
